from flask import Flask
from .extensions import db
from .routes import user_bp
from app.routes.redis_routes import redis_bp
from app.routes.rabbitmq_routes import rabbitmq_bp

def create_app():
    app = Flask(__name__)
    app.config.from_object('config.Config')

    db.init_app(app)
    app.register_blueprint(user_bp)
    app.register_blueprint(redis_bp, url_prefix='/redis')
    app.register_blueprint(rabbitmq_bp, url_prefix='/rabbitmq')
    with app.app_context():
        db.create_all()
    return app